package domain;

import java.util.Collection;
import java.util.HashSet;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

@Entity
@Access(AccessType.PROPERTY)
public class Participant extends Actor{

	// Constructors -----------------------------------------------------------

		public Participant() {
			super();
			evaluations = new HashSet<Evaluation>();
			registrations = new HashSet<Registration>();
		}

		// Attributes -------------------------------------------------------------

		private CreditCard creditCard;

		@NotNull
		@Valid
		public CreditCard getCreditCard() {
			return creditCard;
		}

		public void setCreditCard(CreditCard creditCard) {
			this.creditCard = creditCard;
		}
		
		// Relationships ----------------------------------------------------------
		private Collection<Registration> registrations;
		private Collection<Evaluation> evaluations;

		@Valid
		@NotNull
		@OneToMany(mappedBy="participant")
		public Collection<Registration> getRegistrations() {
			return registrations;
		}

		public void setRegistrations(Collection<Registration> registrations) {
			this.registrations = registrations;
		}

		@Valid
		@NotNull
		@OneToMany(mappedBy="participant")
		public Collection<Evaluation> getEvaluations() {
			return evaluations;
		}

		public void setEvaluations(Collection<Evaluation> evaluations) {
			this.evaluations = evaluations;
		}
		
		
}
